<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 
            Math对象的常用方法

            Math { 
                PI：3.141592653589793,
                min: function() {

                },
                ...
             }
         */
        console.log(Math.PI);

        // 获取绝对值
        console.log(Math.abs(-15));
        console.log(Math.abs(15));
        console.log(Math.abs('abc'));

        // 向下取整
        console.log(Math.floor(1.1));
        console.log(Math.floor(1.9));

        // 向上取整
        console.log(Math.ceil(1.1));
        console.log(Math.ceil(1.9));

        // 四舍五入
        console.log("----------------------")
        console.log(Math.round(1.1));
        console.log(Math.round(1.5));
        console.log(Math.round(1.6));
        console.log(Math.round(-1.1));
        console.log(Math.round(-1.5));   //结果是-1
        console.log(Math.round(-1.6));
        console.log(Math.round(-1.7));

    </script>
</head>
<body>
    
</body>
</html>